<?php

namespace app\common\model;

use think\Model;

class Commond extends Model
{
    //
    static function userCommond($user_id){
        $res = UserDevice::all(function($query) use($user_id){
            $query->where("user_id",$user_id);
        });
        $d_id = [];
        foreach($res as $item){
            if($item->device_id){
                $d_id[] = $item->device_id;
            }
        }
        $resp = Commond::all(function($query) use($d_id) {
            $query->whereIn("device_id",$d_id);
        });
        return $resp;
    }
}
